package com.chinawlx.wlxteacher.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;

import com.chinawlx.wlxteacher.utils.WLXConstant;


/**
 * 作者:吴名
 * 时间:16/8/1.
 * 描述:启动屏
 */
public class WLXSplashActivity extends WLXBaseActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //===========================android 第一次安装后打开,home键转后台,点击图标不能恢复页面==============
        if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
            finish();
            return;
        }

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                if (WLXConstant.IS_ACTIVE == 1) {
                    //已登录状态,进入主界面
                    startActivity(WLXCourseOrClazzActivity.class);
                } else {
                    //未登录状态,进入登录页面
                    startActivity(WLXLoginActivity.class);
                }
                WLXSplashActivity.this.finish();
            }
        }, WLXConstant.SPLASH_TIME);
    }
}
